package com.hd.controller;

import com.hd.pojo.Menu;
import com.hd.pojo.Role;
import com.hd.pojo.User;
import com.hd.service.PermissionService;
import com.hd.service.RoleService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.Map;

/**
 * Created by lenovo on 2017/11/2.
 */
@Controller
public class IndexController {

    @Resource
    private PermissionService permissionService;

    @RequestMapping("/index")
    public String indexShow(HttpSession session, Model model){
        User loginUser=  (User) session.getAttribute("loginUser");
        Map<Menu,List<Menu>> menus=permissionService.searchMenus(loginUser.getUserId());
        model.addAttribute("menus",menus);
        return "index";
    }
}
